#! /usr/bin/env python
# encoding: utf-8

"""This class provides the default error pages for Spyro.
They are normal controllers, as well as any other webpage.
"""

from spyro.core.webpage import WebPage
from spyro.internal.httpstatus import HTTPStatus

class Pages(WebPage):
    def not_found(self):
        self.response._status = HTTPStatus.NotFound

        self.response.write("<h1>404 - Not Found</h1>")
        self.response.write("Argh! The page you were looking for was not found")

    def internal_error(self, error=None):
        self.response._status = HTTPStatus.InternalError

        self.response.write("<h1>500 - Internal Server Error</h1>")
        self.response.write("Oops! Something went wrong processing your request")

        if error is not None:
            self.response.write("<br>"*2)
            self.response.write(error)
